package com.allwees.core.elasticsearch.query;

import com.allwees.core.elasticsearch.http.Method;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;

@Data
@Accessors(chain = true)
public class ScriptRequest {
	private Method method;

	private String index;

	private String type;

	private String suffix = "";

	private String script;

	private QueryParams params;

	public String getUrl() {
		String url = "";
		if(StringUtils.isNotBlank(index)) {
			url += index + "/";
		}
		if(StringUtils.isNotBlank(type)) {
			url += type + "/";
		}
		return  url + suffix;
	}
}
